﻿<from class="layui-form layui-form-pane" action="" lay-filter="form-setting">
    <div class="layui-form-item">
        <label class="layui-form-label">Name</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="title" autocomplete="off" readonly
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">Value</label>
        <div class="layui-input-block">
            <input type="text" name="value" lay-verify="required" autocomplete="off"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item" style="text-align: center;">
        <button class="layui-btn" lay-submit="" lay-filter="setting">确认修改</button>
    </div>
</from>
<script type="text/javascript">

    layui.define(['layer', 'form'], function () {
        var form = layui.form;

        $.getJSON("../setting/get/" + workUtils.get("name"), function (data) {
            $("[name='name']").val(data.name);
            $("[name='value']").val(data.value);
        });

        form.on('submit(setting)', function (data) {
            var index = layer.load(1);
            setTimeout(function () {
                workUtils.ajaxPost("../setting/edit",data.field,function (result) {
                    layer.close(index);
                    workUtils.msg(result);
                });
            }, 400);
            return false;
        });
    });
</script>